***New figures conjoint chapter, compare MM and AMCE	
		
		
		

***Fig.7.7a

set scheme plotplain

use amce_mm_de.dta, clear // Germany
				
drop if statistic=="AMCE"
				
rename lower yl
rename upper yu
rename estimate ate 
gen tg=0
replace tg=1 if level=="Begrenzte Macht"
replace tg=2 if level=="Einige Macht"
replace tg=3 if level=="Viel Macht"
gen inter=0
replace inter=1 if by=="intcoop: a bad thing"
replace inter=2 if by=="intcoop: neither good nor bad"
replace inter=3 if by=="intcoop: a good thing"

*gen statistic=0
*replace statistic=1 in 4/6
*label define stat 0 "Difference in ACME" 1 "Difference in MM"
 			
local varname ate
local group1 inter
local group2 tg   
sort `group1' `group2'
 
gen x = _n  
ed id by x tg inter
replace x = _n + 1 if _n >= 4
replace x = _n + 2 if _n >= 7

separate ate, by(tg)
separate yu, by(tg)
separate yl, by(tg)
		
twoway (scatter ate1 x , msymbol(S) msize(medium) mcolor(black)) ///
       (rcap yu1 yl1 x, lcolor(black))  ///
       (scatter ate2 x , msymbol(Oh) msize(large) mcolor(black)) ///
       (rcap yu2 yl2 x, lcolor(black) )  ///
       (scatter ate3 x , msymbol(T) msize(medium) mcolor(black)) ///
       (rcap yu3 yl3 x, lcolor(black) )  ///
, scheme(lean1)  ///
	   xlabel(none) xtitle(" ", size(3)) b2("") ///
	   ytitle(Marginal Means, size(3)) yscale(r(0.4(.2)0.6)) ///
	   text(0.39 1.5 "a bad thing", place(e) size(2.5)) ///
	   text(0.39 5 "neither good nor bad", place(e) size(2.5)) ///
	   text(0.39 9 "a good thing", place(e) size(2.5)) ///
	   legend(order(1 "Limited power" 3 "Some power" 5 "Extensive power") position(1) row(1) ring(0)) ///
	   graphregion(color(white)) ylab(, labsize(2.5) nogrid) 
	   
	   
	   
***Fig.7.7b

set scheme plotplain

use amce_mm_de.dta, clear // Germany
				
drop if statistic=="MMs"
				
rename lower yl
rename upper yu
rename estimate ate 
gen tg=0
tab level
replace tg=1 if level=="Begrenzte Macht"
replace tg=2 if level=="Einige Macht"
replace tg=3 if level=="Viel Macht"
gen inter=0
replace inter=1 if by=="intcoop: a bad thing"
replace inter=2 if by=="intcoop: neither good nor bad"
replace inter=3 if by=="intcoop: a good thing"
 			
local varname ate
local group1 inter
local group2 tg   
sort `group1' `group2'
 
gen x = _n  
ed id by x tg inter
replace x = _n + 1 if _n >= 4
replace x = _n + 2 if _n >= 7

separate ate, by(tg)
separate yu, by(tg)
separate yl, by(tg)
		
twoway (scatter ate1 x , msymbol(S) msize(medium) mcolor(black)) ///
       (rcap yu1 yl1 x, lcolor(black))  ///
       (scatter ate2 x , msymbol(Oh) msize(large) mcolor(black)) ///
       (rcap yu2 yl2 x, lcolor(black) )  ///
       (scatter ate3 x , msymbol(T) msize(medium) mcolor(black)) ///
       (rcap yu3 yl3 x, lcolor(black) )  ///
, scheme(lean1)  ///
	   xlabel(none) xtitle(" ", size(3)) b2("") ///
	   ytitle(Average Marginal Component Effects, size(mediumsmall)) yscale(r(-0.2(.2)0.1)) ///
	   text(-0.17 1.5 "a bad thing", place(e) size(2.5)) ///
	   text(-0.17 5 "neither good nor bad", place(e) size(2.5)) ///
	   text(-0.17 9 "a good thing", place(e) size(2.5)) ///
	   legend(order(1 "Limited power" 3 "Some power" 5 "Extensive power") position(1) row(1) ring(0)) ///
	   graphregion(color(white)) ylab(, labsize(2.5) nogrid)   ///
yline(0, lcolor(black) lpattern(dash)) 
   
	   
	   
	   
	   
	  	

***Fig.7.9a

set scheme plotplain

use amce_mm_de_purpose.dta, clear // Germany
				
drop if statistic=="AMCE"
				
rename lower yl
rename upper yu
rename estimate ate 
gen tg=0
replace tg=1 if level=="Frieden und Sicherheit zu gewähren"
replace tg=2 if level=="Armut zu bekämpfen"
replace tg=3 if level=="Menschenreche zu schützen"
replace tg=4 if level=="Freihandel voranzutreiben"
replace tg=5 if level=="den Klimawandel zu bekämpfen"
replace tg=6 if level=="die Volksgesundheit zu verbessern"
gen inter=0
replace inter=1 if by=="twolargestparties: twolargestparties: CDU/CSU"
replace inter=2 if by=="twolargestparties: twolargestparties: SPD"
replace inter=3 if by=="twolargestparties: twolargestparties: All others"

*gen statistic=0
*replace statistic=1 in 4/6
*label define stat 0 "Difference in ACME" 1 "Difference in MM"
 			
local varname ate
local group1 inter
local group2 tg   
sort `group1' `group2'
 
gen x = _n  
ed id by x tg inter
replace x = _n + 2 if _n >= 7
replace x = _n + 4 if _n >= 13


separate ate, by(tg)
separate yu, by(tg)
separate yl, by(tg)
		
twoway (scatter ate1 x , msymbol(S) msize(medium) mcolor(black)) ///
       (rcap yu1 yl1 x, lcolor(black))  ///
       (scatter ate2 x , msymbol(Oh) msize(large) mcolor(black)) ///
       (rcap yu2 yl2 x, lcolor(black) )  ///
       (scatter ate3 x , msymbol(T) msize(medium) mcolor(black)) ///
       (rcap yu3 yl3 x, lcolor(black) )  ///
       (scatter ate4 x , msymbol(C) msize(medium) mcolor(black)) ///
       (rcap yu4 yl4 x, lcolor(black) )  ///
       (scatter ate5 x , msymbol(D) msize(medium) mcolor(black)) ///
       (rcap yu5 yl5 x, lcolor(black) )  ///
       (scatter ate6 x , msymbol(oh) msize(medium) mcolor(black)) ///
       (rcap yu6 yl6 x, lcolor(black) )  ///
, scheme(lean1)  ///
	   xlabel(none) xtitle(" ", size(3)) b2("") ///
	   ytitle(Marginal Means, size(3)) yscale(r(0.35(.2)0.8)) ///
	   text(0.34 1.5 "CDU/CSU", place(e) size(2.5)) ///
	   text(0.34 10 "SPD", place(e) size(2.5)) ///
	   text(0.34 16 "All other", place(e) size(2.5)) ///
	   legend(order(1 "Frieden und Sicherheit" 3 "Armut" 5 "Menschenrechte" 7 "Freihandel" 9 "Klimawandel" 11 "Volksgesundheit") position(1) row(2) ring(0)) ///
	   graphregion(color(white)) ylab(, labsize(2.5) nogrid angle(horizontal)) 
	   
	   
	   
***Fig.7.9b

 use "/Users/mariadellmuth/Dropbox/Papers/Sociallegitimacy/Legitimacy Book/Analysis/ch7_socialpurpose-conjoint/conjointmm/amce_mm_de_purpose.dta", clear

			
drop if statistic=="MMs"
				
rename lower yl
rename upper yu
rename estimate ate 
gen tg=0
tab level
replace tg=1 if level=="Frieden und Sicherheit zu gewähren"
replace tg=2 if level=="Armut zu bekämpfen"
replace tg=3 if level=="Menschenreche zu schützen"
replace tg=4 if level=="Freihandel voranzutreiben"
replace tg=5 if level=="den Klimawandel zu bekämpfen"
replace tg=6 if level=="die Volksgesundheit zu verbessern"
gen inter=0
replace inter=1 if by=="twolargestparties: twolargestparties: CDU/CSU"
replace inter=2 if by=="twolargestparties: twolargestparties: SPD"
replace inter=3 if by=="twolargestparties: twolargestparties: All others"
			
local varname ate
local group1 inter
local group2 tg   
sort `group1' `group2'
 
gen x = _n  
ed id by x tg inter
replace x = _n + 2 if _n >= 7
replace x = _n + 4 if _n >= 13

separate ate, by(tg)
separate yu, by(tg)
separate yl, by(tg)
		
twoway (scatter ate1 x , msymbol(S) msize(medium) mcolor(black)) ///
       (rcap yu1 yl1 x, lcolor(black))  ///
       (scatter ate2 x , msymbol(Oh) msize(large) mcolor(black)) ///
       (rcap yu2 yl2 x, lcolor(black) )  ///
       (scatter ate3 x , msymbol(T) msize(medium) mcolor(black)) ///
       (rcap yu3 yl3 x, lcolor(black) )  ///
	   (scatter ate4 x , msymbol(C) msize(medium) mcolor(black)) ///
       (rcap yu4 yl4 x, lcolor(black) )  ///
       (scatter ate5 x , msymbol(D) msize(medium) mcolor(black)) ///
       (rcap yu5 yl5 x, lcolor(black) )  ///
       (scatter ate6 x , msymbol(oh) msize(medium) mcolor(black)) ///
       (rcap yu6 yl6 x, lcolor(black) )  ///
, scheme(lean1)  ///
	   xlabel(none) xtitle(" ", size(3)) b2("") ///
	   ytitle(Average Marginal Component Effects, size(3)) yscale(r(-0.3(.1)0.2)) ///
	   text(-0.33 2 "CDU/CSU", place(e) size(2.5)) ///
	   text(-0.33 11 "SPD", place(e) size(2.5)) ///
	   text(-0.33 17 "All other", place(e) size(2.5)) ///
	   legend(order(1 "Frieden und Sicherheit" 3 "Armut" 5 "Menschenrechte" 7 "Freihandel" 9 "Klimawandel" 11 "Volksgesundheit") position(1) row(2) ring(0)) ///
	   graphregion(color(white)) ylab(, labsize(2.5) nogrid angle(horizontal))   ///
yline(0, lcolor(black) lpattern(dash)) 
  

	   
